package show.marvelous.domain.chessgame.aggregate.entity;

import java.util.ArrayList;
import java.util.Collection;
import show.marvelous.domain.chessgame.constans.AirPlanColorEnum;
import show.marvelous.domain.chessgame.constans.PieceCodeEnum;
import show.marvelous.domain.chessgame.constans.PieceEnum;

/**
 * @author Kris
 * 2021/9/14
 */
public class PositionFactory{

    public static Collection<Position> buildPositions(){
        Collection<Position> positions = new ArrayList<>();
        for(AirPlanColorEnum color : AirPlanColorEnum.values()){
            Position ceilingPosition = PositionBuilder.position().color(color).index(Position.CEILING_INDEX).build();
            for(PieceCodeEnum code : PieceCodeEnum.values()){
                ceilingPosition.gotPiece(PieceEnum.of(color, code));
            }
            positions.add(ceilingPosition);
            positions.add(PositionBuilder.position().color(color).index(Position.TAKE_OFF_INDEX).build());
            positions.add(PositionBuilder.position().color(color).index(Position.END_INDEX).build());
            for(int i = 0; i <= 12; i++){
                positions.add(PositionBuilder.position().color(color).index(4 * i + 2).build());
            }
        }
        return positions;
    }
}
